/**
 * Created by zhaojm on 15/3/17.
 */
game.Config = {

    language : game._Enum.language.en,    // cn or en


    //interval:0.01,  // 背景移动的  间隔 和 速度
    speed : 3,

    hero_gravity:-1000,  // 重力
    hero_jump_speed_y : 600,    // 初始速度


    barrier_interval_max : 600, // 障碍物之间的距离
    barrier_interval_min : 300,

    moster_interval_max:600,
    moster_interval_min:100,

    //barrier_scale_num_min : 0.5,  // 障碍物缩放
    //barrier_scale_num_max : 1,

    //moster_scale_num_min : 0.4,
    //moster_scale_num_max:0.6,

    moster_y_percent_max : 0.45,
    moster_y_percent_min : 0.05, // 怪物高度变化范围

    hero_default_y_percent : 0.3,   // 英雄相对于 屏幕的  百分比高度
    hero_default_x_percent : 0.2,

    timeScore : 10, // 每个金币的分数

    walter_height_percent : 0.57,    // 水面高度

    coin_interval_max:300,
    coin_interval_min:100,

    coin_y_percent_max:0.5,
    //coin_y_percent_min:0.1,

    //default_heart : 3,  // 血量


    fishType:{
        a : {
            idle:['fish0/idle/0.png', 'fish0/idle/1.png', 'fish0/idle/2.png', 'fish0/idle/3.png'],
            collided:['fish0/collided/0.png', 'fish0/collided/1.png'],
            heart : 2,
            fishname:'普通跳跳鱼'

        },

        b:{
            idle:['fish1/idle/0.png','fish1/idle/1.png', 'fish1/idle/2.png', 'fish1/idle/3.png'],
            collided:['fish1/collided/0.png', 'fish1/collided/1.png', 'fish1/collided/2.png'],
            heart : 5,
            fishname:'超级跳跳鱼'
        },
        //c:{
        //    idle:['fish2/idle/0.png','fish2/idle/1.png', 'fish2/idle/2.png', 'fish2/idle/3.png', 'fish2/idle/4.png'],
        //    collided:['fish2/collided/0.png', 'fish2/collided/1.png', 'fish2/collided/2.png'],
        //    heart : 5,
        //    fishname:'神仙跳跳鱼'
        //}
    },



    fishRes:[
        'fish0.png','fish1.png', 'fish2.png', 'fish3.png'
    ],

    // 新手引导
    guideConfig : {
        task1 : {
            log:'点击屏幕，让鱼跳起来'
        },
        task2:{
            log:'再次点击屏幕，鱼可以跳的更高'
        },
        task3:{
            log:'开始游戏之旅吧'
        },
    },

    model : 'guide',



};

game.ConfigHelper = {

    //getInterval : function(){
    //    return game.Config.interval;
    //},
    getSpeed : function(){
        return game.Config.speed;
    },

    getBarrierInterval : function(){
        return Math.random() * (game.Config.barrier_interval_max - game.Config.barrier_interval_min) + game.Config.barrier_interval_min;
    },
    getCloudInterval:function(){
        return Math.random() * (1000 - 300) + 300;
    },
    getCoinInterval:function(){

        return Math.random() * (game.Config.coin_interval_max - game.Config.coin_interval_min) + game.Config.coin_interval_min;

    },

    getMosterInterval:function(){
        return Math.random() * (game.Config.moster_interval_max - game.Config.moster_interval_min) + game.Config.moster_interval_min;
    },

    getBarrierScale : function(){
        return 1;

        //return Math.random() * (game.Config.barrier_scale_num_max - game.Config.barrier_scale_num_min) + game.Config.barrier_scale_num_min;
    },
    //getMosterScale:function(){
    //    return Math.random() * (game.Config.moster_scale_num_max - game.Config.moster_scale_num_min) + game.Config.moster_scale_num_min;
    //},

    getOneCoinMatrix:function(){
        var index =  Math.floor(Math.random() * game.Config.coinMatrixList.length);
        return game.Config.coinMatrixList[index];
        //var matrix = {};
        //matrix.numlist = [];
        //matrix.x = Math.floor(Math.random() * 5) + 1;
        //matrix.y = Math.floor(Math.random() * 4) + 1;
        //for(var i = 0; i < matrix.x * matrix.y; i++){
        //    var b = Math.floor(Math.random() * 2) % 2;
        //    if(b != 0 && b != 1){
        //        b = 1;
        //    }
        //    matrix.numlist.push(b);
        //}
        ////cc.log(matrix);
        //return matrix;


    },
    getOneCoinMatrixByIndex : function(index){
        return game.Config.coinMatrixList[index];
    },

    getMosterYPercent : function(){
        return Math.random() * (game.Config.moster_y_percent_max - game.Config.moster_y_percent_min) + game.Config.moster_y_percent_min;
    },

    getCoinYPercent : function(){
        return game.Config.coin_y_percent_max;
        //return Math.random() * (game.Config.coin_y_percent_max - game.Config.coin_y_percent_min) + game.Config.coin_y_percent_min;
    },


};

game.Config.coinMatrixList = [
    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            1, 0, 0,
            1, 1, 1,
            0, 0, 1,
            1, 1, 1
        ]
    },
    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            1, 0, 1,
            1, 1, 1,
            0, 0, 1,
            1, 1, 1
        ]
    },
    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            1, 0, 0,
            1, 1, 1,
            1, 0, 1,
            1, 1, 1
        ]
    },
    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            1, 0, 1,
            1, 0, 1,
            1, 0, 1,
            1, 1, 1
        ]
    },
    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            0, 0, 1,
            1, 1, 1,
            1, 0, 0,
            1, 1, 1
        ]
    },
    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            0, 0, 1,
            1, 1, 1,
            0, 0, 1,
            1, 1, 1
        ]
    },
    {
        x:3,
        y:5,
        numlist :[
            1, 0, 1,
            1, 0, 1,
            1, 1, 1,
            0, 0, 1,
            0, 0, 1
        ]
    },

    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            1, 0, 1,
            0, 0, 1,
            0, 0, 1,
            0, 0, 1
        ]
    },

    {
        x:3,
        y:5,
        numlist :[
            1, 1, 1,
            1, 0, 1,
            1, 1, 1,
            1, 0, 1,
            1, 1, 1
        ]
    },

    {
        x:3,
        y:5,
        numlist :[
            0, 0, 1,
            0, 0, 1,
            0, 0, 1,
            0, 0, 1,
            0, 0, 1
        ]
    },

];